]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status: Use fixed sorting of input sources on empty MRU
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 14 Sep 2022 18:20:14 +0000 (20:20 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 17 Sep 2022 18:18:43 +0000 (18:18 +0000)
When updating the MRU sources if there was no prior MRU, we want
to go with the unmodified list of sources in visibility order.

However iterating over object properties happens in an undetermined
order, so the initial MRU list ends up picking a value at random.

In order to prefer the sources list in the same order than they
appear in the menu if there was no prior MRU, order the keys
when accessing it and building the initial list of sources.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5873
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2487>

js/ui/status/keyboard.js

index 76a42f6bd701f31856ef2064b6f090d5a5e87007..65b3962731e175d41c82fd80dbc2af76507e465c 100644 (file)
@@ -492,7 +492,7 @@ var InputSourceManager = class extends Signals.EventEmitter {
 
     _updateMruSources() {
         let sourcesList = [];
-        for (let i in this._inputSources)
+        for (let i of Object.keys(this._inputSources).sort((a, b) => a - b))
             sourcesList.push(this._inputSources[i]);
 
         this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));